$(document).ready(function(){
    //轮播图
    var lun_url=myconfig['api']+'focus';
    $.post(lun_url, {},function(data,status){
            $.each(data,function(idx,item){
                $('#lun_url').append('<div class="swiper-slide"><img src="'+myconfig['url']+item.image+'"></div>');
				 
            });
			var swiper = new Swiper('.swiper-container', {
					paginationClickable: true,
					pagination: '.swiper-pagination',
					centeredSlides: true,
					loop:true,
					slidesPerView: 1,
					effect : 'fade',
					fade: {crossFade: false,},
				 	autoplay:5000,
					autoplayDisableOnInteraction: false,
				});
        },'json');
	
    //精品推荐
    var lun_tu=myconfig['api']+'isrecommend&mod=trial';
    $.post(lun_tu, {},function(data,status){
        $.each(data.data,function(idx,item){
            htm='<li class="swiper-slide">';
			htm+='<a href="/templates/trial/show_trial.html?goods_id='+item.id+' ">';
            htm+='<div class="hot_list_img"><img src="'+myconfig['url']+item.thumb+'"></div>';
            htm+='<div class="hot_list_title">'+item.title+'</div>';
            htm+='<div class="hot_list_price"><span>￥'+item.goods_price+'</span><b>'+item.number+'份</b></div>';
            htm+='</a>';
			htm+='</li>';
            $('#lun_tu').append(htm);
			$(".loading").hide()
        });
		
		var swiper = new Swiper('.hot_slider', {
				slidesPerView: 3,
				paginationClickable: true,
				spaceBetween: 10,
				autoplay : 5000,
				loop:true,
			});
    },'json');
    //最新上线
    var lun_list=myconfig['api']+'goodslists&catid=0&mod=trial&orderby=id&orderway=desc&page=1';
    $.get(lun_list, {},function(data,status){
        $.each(data.lists,function(key,item){
            htms='<li>';
			htms+='<a href="/templates/trial/show_trial.html?goods_id='+item.id+' ">';
            htms+='<div class="new_list_img"><img src="'+myconfig['url']+item.thumb+'"></div>';
            htms+='<div class="new_list_title">'+item.title+'</div>';
            htms+='<div class="new_list_price"><span>￥'+item.goods_price+'</span><b>'+item.number+'份</b></div>';
            htms+='</a>	';
			htms+='</li>';
            $('#lun_list').append(htms);
			$(".loading").hide()
        });
    },'json');
});
